<script>
export default {
  name: 'SuccessInfo',
  props: {
    info: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {}
  },
  render(h) {
    const { failNum, successNum, totalNum, ...errorInfo } = this.info
    return (
      <ul>
        <li class={this.info.totalNum ? '' : 'd-none'}>
          共提交{this.info.totalNum}条数据，成功
          <span class="color-1989fa">{this.info.successNum}</span>条，失败
          <span class="d-red ">{this.info.failNum}</span>条
        </li>
        <li class={!this.info.totalNum ? '' : 'd-none'}>完结成功</li>
        {Object.keys(errorInfo).map((item, i) => {
          const values = Object.values(errorInfo)
          return (
            <li class={Object.keys(errorInfo).length === 0 ? 'd-none' : ''}>
              <div>
                失败原因：<span class="d-red">{item}</span>，相关采购单号如下：
              </div>
              {values[i].map(_ => {
                return <p style="font-size:18px;">{_}</p>
              })}
            </li>
          )
        })}
      </ul>
    )
  }
}
</script>
